﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.WebApiTool
{
    class Util
    {
        public static string ResolveProperty(string propertyName)
        {
            if (string.IsNullOrEmpty(propertyName))
            {
                return string.Empty;
            }
            if (propertyName.Length == 1)
            {
                if (Program.s_settings.IsCamelCasePropertyName)
                {
                    return propertyName.ToLower();
                }
                else
                {
                    return propertyName.ToUpper();
                }
            }
            else
            {
                if (Program.s_settings.IsCamelCasePropertyName)
                {
                    return string.Format("{0}{1}", propertyName.Substring(0, 1).ToLower(), propertyName.Substring(1, propertyName.Length - 1));
                }
                else
                {
                    return string.Format("{0}{1}", propertyName.Substring(0, 1).ToUpper(), propertyName.Substring(1, propertyName.Length - 1));
                }
            }
        }
    }
}
